<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        const obj = {
            name: "GG"
            ,text:{
                name:"DD"
            }
        }
// 进行浅复制
        const obj1 = Object.assign({},obj)
        console.log(obj === obj1);
        console.log(obj.text.name === obj1.text.name);
        const obj2 = structuredClone(obj)//进行深复制
        console.log(obj === obj2);
        console.log(obj.text.name === obj2.text.name);
        obj.text.name = "DSAFSG"
        console.log(obj,obj1,obj2);
        const str = JSON.stringify(obj)
        const obj4 = JSON.parse(str)
        console.log(obj === obj1);
        console.log(obj.text.name === obj4.text.name);
        obj.text.name = "xx"
        console.log(obj.text.name === obj4.text.name);
        console.log(obj,obj4);

    </script>

</head>
<body>
    
</body>
</html>